package com.company.sendemo.basics.akJavaString.basicsstring;

public class Six_CharTurnString {

    public static void att(){
        System.out.println(5);
    }
    public static void main(String[] args) {
        char A = 'A';
        String B = "AB";

        //String -——> char
        System.out.println(B.charAt(1)); //返回char 可以得到String某一指定位置的char
        System.out.println(B.toCharArray());


        //char  --->  String
        System.out.println(String.valueOf('c')); //效率最高的方法
        System.out.println(String.valueOf(new char[]{'c'})); //将一个char数组转换成String
        System.out.println(Character.toString('c')); //该方法实际上直接返回String.valueOf('c')
        System.out.println( new Character('c').toString());
        System.out.println(""+'c');  //简单 效率低
        new StringBuffer().append("").append('c').toString();
        System.out.println(new String(new char[]{'c'}));


        int a =100,b=50,c=a---b,d=a---b;
        System.out.println(a);//98
        System.out.println(b);//50
        System.out.println(c);//50
        System.out.println(d);//49

//        当x=1,2,3时，会输出”Test2“?
        int x = 2;
        switch ( x)
        {
            case 1: System.out.println("Test1");
            case 2:System.out.println("Test11");
            case 3:System.out.println("Test111");
                System.out.println("Test2");
                break;
            default:
                System.out.println("Test3");
                break;
        }

        int aa =1;

            aa --;
        System.out.println(aa);
        System.out.println(9/4);



    }


}
